package me.ereach.multi;

public class DownloadFileTask implements Runnable {
    private DownloadStatus status;

    public DownloadFileTask() {
        status = new DownloadStatus();
    }

    public DownloadFileTask(DownloadStatus status) {
        this.status = status;
    }

    public DownloadStatus getStatus() {
        return status;
    }

    public int getTotalBytes() {
        return status.getTotalBytes();
    }

    @Override
    public void run() {
        System.out.println("DownloadTask started: " + Thread.currentThread().getName());

        for (var i = 0; i < 10000; i++)
            status.incrementTotalBytes();

        System.out.println("DownloadTask finished: " + Thread.currentThread().getName());
    }
}
